package com.lei.springbootpractice.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lei.springbootpractice.pojo.ReviewPojo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface ReviewDao extends BaseMapper<ReviewPojo> {
    @Select("SELECT AVG(rate) FROM review WHERE product_id = #{productId}")
    Double selectAvgRating(@Param("productId") String productId);
}
